package com.ipoint.icompany.model;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.validator.NotNull;
import org.jboss.seam.annotations.Name;

@Entity
@Name("workingDay")
@Table(name = "WorkingDay")
public class WorkingDay {
	private Long id;
	private Day day;
	private Person person;
	private int amountMinuts;
	private String description;
	private Set<WorkingDayOnProject> workingDayOnProjectSet;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "workingDay", cascade = CascadeType.ALL)
	public Set<WorkingDayOnProject> getWorkingDayOnProjectSet() {
		return workingDayOnProjectSet;
	}

	public void setWorkingDayOnProjectSet(
			Set<WorkingDayOnProject> workingDayOnProjectSet) {
		this.workingDayOnProjectSet = workingDayOnProjectSet;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getAmountMinuts() {
		return amountMinuts;
	}

	public void setAmountMinuts(int amountMinut) {
		this.amountMinuts = amountMinut;
	}

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@NotNull
	@JoinColumn(name = "dayId")
	public Day getDay() {
		return day;
	}

	public void setDay(Day day) {
		this.day = day;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@NotNull
	@JoinColumn(name = "personId")
	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}
}
